<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../js/jquery.min.js"></script>
</head>

<body>
  <button id="btn">点我发起post请求</button>
  <script>
    $(() => {
      $('#btn').on('click', function () {
        $.ajax({
          type: 'POST',//请求方式
          url: 'http://liulongbin.top:3006/api/addbook',//请求的url地址
          data: {
            bookname: "聊斋",
            author: "施耐庵",
            publisher: "北京图书出版社"
          },
          success: res => {//请求成功后的回调函数
            console.log(res)
          }
        })
      })

    })
  </script>
</body>

</html>